package com.zengqingfa.basic.generics;

/**
 * @fileName: GenericMethod
 * @author: zengqf3
 * @date: 2020-9-5 19:34
 * @description:
 */
public class Generic {
    /**
     * 测试泛型通配符
     *
     * @param obj
     */
    public void showKeyValue1(GenericClass<Number> obj) {
        System.out.println("泛型测试:key value is " + obj.getKey());
    }

    /**
     * 测试泛型通配符
     *
     * @param obj
     */
    public void showKeyValue2(GenericClass<?> obj) {
        System.out.println("泛型测试:key value is " + obj.getKey());
    }

    /**
     * 测试上边界
     *
     * @param obj
     */
    public void showKeyValue3(GenericClass<? extends Number> obj) {
        System.out.println("泛型测试:key value is " + obj.getKey());
    }

    /**
     * 测试下边界
     *
     * @param obj
     */
    public void showKeyValue4(GenericClass<? super Integer> obj) {
        System.out.println("泛型测试:key value is " + obj.getKey());
    }
}
